

//
//  NGovDataInqueryViewController.m
//  nncloud
//
//  Created by macfai on 2018/12/20.
//  Copyright © 2018 macfai. All rights reserved.
//

#import "NGovDataInqueryViewController.h"
#import "NMineCell.h"
#import "NIndustryDataInqueryDetailVC.h"
#import "NCaiwuDataInqDetailVC.h"

#import "NEnterpriseSearchVC.h"

@interface NGovDataInqueryViewController ()<UITableViewDataSource,UITableViewDelegate>

@property(nonatomic,strong)UITableView *tableView;
@property(nonatomic,strong)NSMutableArray *dataArray;
@property(nonatomic,strong)NSArray *titleArray;
@property(nonatomic,strong)NSArray *headerTitles;
@property(nonatomic,strong)NSArray *names;
@property(nonatomic,strong)NSArray *pickerArray;
@property(nonatomic,strong)NSArray *imgArray;
@property (nonatomic,assign)NSInteger index;

@end

@implementation NGovDataInqueryViewController

#define cellIdentifier @"mineid"
#define SectionHeaderHeight  60.f

-(UITableView *)tableView{
    if (!_tableView) {
        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0 , 0, ScreenWidth , ScreenHeight - 64) style:UITableViewStyleGrouped];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.rowHeight = 85.f;
        _tableView.backgroundColor = kBackgroundColor;
        [_tableView registerNib:[UINib nibWithNibName:@"NMineCell" bundle:nil] forCellReuseIdentifier:cellIdentifier];
        _tableView.showsVerticalScrollIndicator = NO;
        //_tableView.tableFooterView = [UIView new];
    }
    return _tableView;
}


- (void)searchZhiwei {
    
    YYLog(@"搜索职位");
    ///跳转到企业列表
    
//    NSerchZhiweiViewController *search = [NSerchZhiweiViewController new];
//    [self.navigationController pushViewController:search animated:YES];
    
}
- (void)viewDidLoad {
    
    [super viewDidLoad];
    self.view.backgroundColor = kWhiteColor;
    self.dataArray = [NSMutableArray array];
    
    //政府端数据查询
    [self.navigationItem setItemWithTitle:@"数据查询" textColor:kNavigationTitleColor fontSize:18 itemType:center];
    
    self.titleArray = @[@"",@"行业",@"职业类型",@"所在地区",@"工作性质",@"学习要求",@"工作经验"];
    //
    self.headerTitles = @[@"工业数据查询",@"财务数据查询"];
    self.imgArray = @[@"全量数据查询",@"企业数据查询",]; //同时也是title
    [self.view addSubview:self.tableView];
    // Do any additional setup after loading the view.
}
- (void)tapAction:(UIButton *)btn
{
    
}

#pragma mark - datasource

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return  2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return  2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    NMineCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
    cell.LogoImage.image = WDImgName(self.imgArray[indexPath.row]);
    cell.nameLabel.text = self.imgArray[indexPath.row];
    return cell;
}

#pragma mark - delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    //标记是工业数据还是财务数据
    [NUserModel shareInstance].isIndustryDataInq = YES;
    if (indexPath.section==0) {
        
        if (indexPath.row==0) {
            
            [NUserModel shareInstance].isAllData = YES;//标记全量查询
            NIndustryDataInqueryDetailVC *detail = [NIndustryDataInqueryDetailVC new];
            [self.navigationController pushViewController:detail animated:YES];
            
        }else{
            
            [NUserModel shareInstance].isAllData = NO;//标记是否全量查询
            NEnterpriseSearchVC *detail = [NEnterpriseSearchVC new];
            [self.navigationController pushViewController:detail animated:YES];
        }
        
    }else{
        
        //
        [NUserModel shareInstance].isIndustryDataInq = NO;
        if (indexPath.row==0) {
            NCaiwuDataInqDetailVC *detail = [NCaiwuDataInqDetailVC new];
            [self.navigationController pushViewController:detail animated:YES];
        }else{
            NEnterpriseSearchVC *detail = [NEnterpriseSearchVC new];
            [self.navigationController pushViewController:detail animated:YES];
        }
    }
   
}


#pragma mark - section head
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return SectionHeaderHeight;//如果设置section的header高度，不设置footer高度，footer默认等于header高度
}


- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, SectionHeaderHeight)];
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(25, 0, ScreenWidth, SectionHeaderHeight)];
    label.text = self.headerTitles[section];
    label.textColor = kDarkGrayColor;
    [view addSubview:label];
    view.backgroundColor = kBackgroundColor;
    return view;
}

#pragma mark - section foot
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0;
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    return nil;
}



@end
